package com.itheima.wisdomnext.mapper;

import com.itheima.wisdomnext.entity.Report;
import com.itheima.wisdomnext.entity.ReportReason;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ReportMapper {

    // 插入举报记录
    @Insert("INSERT INTO reports (reporter_id, target_id, target_type, reason, report_reason_id) " +
            "VALUES (#{reporterId}, #{targetId}, #{targetType}, #{reason}, #{reportreasonId})")
    void insertReport(Report report);

    // 查询所有举报理由类型
    @Select("SELECT id,reason FROM report_reasons")
    List<ReportReason> Reportreasons();

    // 查询所有举报记录
    @Select("SELECT * FROM reports")
    List<Report> findAllReports();

    // 根据用户 ID 查询举报记录
    @Select("SELECT * FROM reports WHERE reporter_id = #{reporterId}")
    List<Report> findReportsByUserId(Integer reporterId);
}
